import { RouterModule, Routes,Data} from '@angular/router';
import { SigninComponent } from './signin/signin.component';
import { IndexComponent } from './index/index.component';
import { LoginGuard } from '../services/guard/loginGuard';
import { AdminGuard } from '../services/guard/adminGuard';
import { StudentGuard } from '../services/guard/studentGuard';
const routes: Routes = [
    { path: '', redirectTo: 'signin', pathMatch: 'full',data:{title:'登录'} },
    { path: 'signin',  component: SigninComponent,data:{title:'登录'}},
    { path: '',  component: IndexComponent,data:{title:'首页'},canActivate:[LoginGuard],
      children:[
        { path: 'personal', loadChildren: './personal/personal.module#PersonalModule',data:{title:'个人信息'},canActivate:[AdminGuard]},
        { path: 'score', loadChildren: './score/score.module#ScoreModule',data:{title:'成绩管理'},canActivate:[AdminGuard]},
        { path: 'course', loadChildren: './course/course.module#CourseModule',data:{title:'课程管理'},canActivate:[AdminGuard] },
        { path: 'user', loadChildren: './user/user.module#UserModule',data:{title:'用户管理'},canActivate:[AdminGuard] },
        { path: 'myAccount', loadChildren: './myAccount/myAccount.module#MyAccountModule',data:{title:'我的账户'},canActivate:[StudentGuard]},
        { path: 'myScores', loadChildren: './myScores/myScores.module#MyScoresModule',data:{title:'我的成绩'},canActivate:[StudentGuard]}
      ]
    }
];
export const routing = RouterModule.forRoot(routes);
